package com.fjp.heartguard.viewmodel

import androidx.lifecycle.MutableLiveData
import com.fjp.heartguard.app.data.bean.QuestionnatireCount
import com.fjp.heartguard.app.network.HttpRequestCoroutine
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel
import me.hgj.jetpackmvvm.ext.request
import me.hgj.jetpackmvvm.state.ResultState

/**
 *Author:Mr'x
 *Time:2025/1/1
 *Description:
 */
class MainViewModel : BaseViewModel() {
    var questionnatireCount = MutableLiveData<ResultState<QuestionnatireCount>>()
    var homeUnreadNumbers = MutableLiveData<ResultState<Int>>()
    var deviceAddLiveData = MutableLiveData<ResultState<String>>()
    fun unreadNumbers() {
        request({
            HttpRequestCoroutine.unreadNumbers()
        }, homeUnreadNumbers, false)

    }

    fun getQuestionnaireCount() {
        request({
            HttpRequestCoroutine.getQuestionnaireCount()
        }, questionnatireCount, false)

    }

    fun deviceAdd(version: String,no:String,province:String,city:String,district:String) {
        request({
            HttpRequestCoroutine.deviceAdd(version,no,province,city,district)
        }, deviceAddLiveData, false)

    }
}